import { createApp } from "vue";
import App from "./App.vue";
// import Layout from "./components/admin/layout.vue";
import router from "./router";
import ElementPlus from "element-plus";
import zhCn from "element-plus/dist/locale/zh-cn.mjs";

// 导入全局样式表
import "./assets/css/global.css";

// 注册所有图标
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

import axios from "@/plugins/axiosInstance.js";

const app = createApp(App);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 全局注册后台管理系统的布局组件 BaseLayout.vue
// 添加这行代码报错: RangeError: Maximum call stack size exceeded
// app.component("Layout", Layout);

app.use(router);
app.use(ElementPlus, {
  locale: zhCn,
});
app.mount("#app");

app.config.globalProperties.$axios = axios; //配置axios的全局引用
